package o;

public class epf {
    private static epf ˎ;
    private static final Object ॱ = new Object();
    private awc ˊ;
    private long ˋ;

    private epf() {
    }

    public static epf ˊ() {
        epf o_epf;
        synchronized (ॱ) {
            if (ˎ == null) {
                ˎ = new epf();
            }
            o_epf = ˎ;
        }
        return o_epf;
    }

    public void ˏ(long j) {
        if (azc.ˎ().ॱ() >= 17) {
            this.ˋ = j;
            if (this.ˊ == null) {
                try {
                    this.ˊ = awc.ˏ(ContentManager.getInstant().getContext(), new awb(this) {
                        final /* synthetic */ epf ˊ;

                        {
                            this.ˊ = r1;
                        }

                        public void ˏ() {
                            this.ˊ.ˊ = null;
                        }

                        public void ॱ() {
                            this.ˊ.ˎ();
                        }
                    });
                    return;
                } catch (SecurityException e) {
                    Logger.e("AudioPowerKitManager", "can not use HuaweiPowerKit SecurityException " + e.getMessage());
                    return;
                } catch (Exception e2) {
                    Logger.e("AudioPowerKitManager", "can not use HuaweiPowerKit Exception " + e2.getMessage());
                    return;
                }
            }
            ˎ();
        }
    }

    private void ˎ() {
        if (this.ˊ != null) {
            try {
                if (this.ˊ.ˏ(ContentManager.getInstant().getContext().getPackageName(), 65535, this.ˋ, "AUDIO")) {
                    Logger.ˎ("AudioPowerKitManager", "apply succeed");
                } else {
                    Logger.e("AudioPowerKitManager", "apply failed");
                }
            } catch (Throwable e) {
                Logger.ˋ("AudioPowerKitManager", "applyForResourceUse failed", e);
                this.ˊ = null;
            } catch (Throwable e2) {
                Logger.ˋ("AudioPowerKitManager", "applyForResourceUse failed", e2);
                this.ˊ = null;
            }
        }
    }

    public void ˋ() {
        if (azc.ˎ().ॱ() >= 17 && this.ˊ != null) {
            try {
                if (this.ˊ.ॱ(ContentManager.getInstant().getContext().getPackageName(), 65535)) {
                    Logger.ˎ("AudioPowerKitManager", "unapply succeed");
                } else {
                    Logger.e("AudioPowerKitManager", "unapply failed");
                }
            } catch (Throwable e) {
                Logger.ˋ("AudioPowerKitManager", "unapplyForResourceUse failed", e);
                this.ˊ = null;
            } catch (Throwable e2) {
                Logger.ˋ("AudioPowerKitManager", "unapplyForResourceUse failed", e2);
                this.ˊ = null;
            }
        }
    }
}
